#include <gtest/gtest.h>
#include "viml/value.h"

TEST(ValueTest, StringCreation) {
    // 测试字符串Value的创建
    viml::Value str_val = viml::Value::string("Hello, World!");
    
    // 调试输出
    std::cout << "String Value created" << std::endl;
    std::cout << "Raw bits: 0x" << std::hex << str_val.raw_bits() << std::dec << std::endl;
    std::cout << "Is NaN: " << str_val.is_nan_debug() << std::endl;
    std::cout << "Tag: 0x" << std::hex << str_val.get_tag_debug() << std::dec << std::endl;
    std::cout << "Data: 0x" << std::hex << str_val.get_data_debug() << std::dec << std::endl;
    
    std::cout << "Debug string: " << str_val.debug_string() << std::endl;
    
    // 现在测试类型检查
    EXPECT_TRUE(str_val.is_string()) << "String value should be recognized as string";
    EXPECT_FALSE(str_val.is_nil()) << "String value should not be nil";
    
    if (str_val.is_string()) {
        EXPECT_EQ(str_val.as_string(), "Hello, World!");
        std::cout << "To string: " << str_val.to_string() << std::endl;
    }
}

TEST(ValueTest, NumberCreation) {
    viml::Value num_val = viml::Value::make_number(42.0);
    
    EXPECT_TRUE(num_val.is_number());
    EXPECT_FALSE(num_val.is_nil());
    EXPECT_EQ(num_val.as_number(), 42.0);
    
    std::cout << "Debug string: " << num_val.debug_string() << std::endl;
}